<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" errorPage="/error.jsp" isELIgnored="false" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache" %>
<%@ taglib uri="http://atleap.blandware.com/taglib" prefix="atleap" %>
<html:xhtml />

<atleap:constants className="com.blandware.atleap.model.core.Sequence" scope="page" var="TYPE_PAGES" />
<atleap:constants className="com.blandware.atleap.model.core.Sequence" scope="page" var="TYPE_RESOURCES" />
<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="OWNER_INFO_KEY" scope="page" />
<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="SEQUENCE_IDENTIFIERS_COLLECTION_KEY" scope="page" />
<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="HTML_TEXT_FIELD_MAX_LENGTH" />
<atleap:javascript formName="sequenceForm" staticJavascript="false" dynamicJavascript="true" method="validateForm" cdata="false" />
<atleap:content identifier="information" ignore="true" uri="/core/sequence/callCreate" />
<atleap:form action="core/sequence/create" method="POST">
    <atleap:messages property="sequenceAlreadyExists" />
    <atleap:messages property="sequenceIncorrectIdentifier" />
    <table cellpadding="0"  cellspacing="0" border="0" class="modificationTable">
        <tr>
            <th><atleap:message key="core.sequence.form.ownerInfo" /></th>
            <td>${sessionScope[pageScope.OWNER_INFO_KEY]}</td>
        </tr>
        <tr>
            <th>
                <atleap:label property="identifier" styleClass="label" key="core.sequence.form.identifier" colon="false" helpTip="true" />
            </th>
            <td>
                <c:choose>
					<c:when test="${sessionScope[pageScope.SEQUENCE_IDENTIFIERS_COLLECTION_KEY] != null}">
						<html:select property="identifier">
							<atleap:iterator items="${sessionScope[pageScope.SEQUENCE_IDENTIFIERS_COLLECTION_KEY ]}" var="identifier">
								<html:option value="${identifier}">${identifier}</html:option>
							</atleap:iterator>
						</html:select>
					</c:when>
					<c:otherwise>
	                    <html:text property="identifier" maxlength="${pageScope.HTML_TEXT_FIELD_MAX_LENGTH}" styleClass="text" />
	                </c:otherwise>
				</c:choose>
            </td>
        </tr>
        <tr>
            <th>
                <atleap:label property="type" styleClass="label"  key="core.sequence.form.type" colon="false" helpTip="true" />
            </th>
            <td>
                <html:select property="type">
                    <html:option key="core.sequence.form.type.0" value="${pageScope.TYPE_PAGES}" />
                    <html:option key="core.sequence.form.type.1" value="${pageScope.TYPE_RESOURCES}" />
                </html:select>
            </td>
        </tr>
    </table>
    <html:hidden property="ownerId"/>
    <atleap:submit styleClass="button"><atleap:message key="core.commons.buttons.create" /></atleap:submit>
    <atleap:cancel styleClass="button"><atleap:message key="core.commons.buttons.cancel" /></atleap:cancel>
</atleap:form>
